home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / gedit-2 / plugins / snippets / chdr.xml < prev    next >
Encoding:
Extensible Markup Language  |  2009-04-14  |  6.8 KB  |  242 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <snippets language="chdr">
  3.   <snippet id="once">
  4.     <text><![CDATA[#ifndef __${1:NAME}_H__
  5. #define __$1_H__
  6.  
  7. $0
  8.  
  9. #endif /* __$1_H__ */
  10. ]]></text>
  11.     <description>Header Include-Guard</description>
  12.     <tag>once</tag>
  13.   </snippet>
  14.   <snippet id="inc">
  15.     <text><![CDATA[#include "${1:file}"
  16. $0]]></text>
  17.     <description>#include ".."</description>
  18.     <tag>inc</tag>
  19.   </snippet>
  20.   <snippet id="Inc">
  21.     <text><![CDATA[#include <${1:file}>
  22. $0]]></text>
  23.     <description>#include <..></description>
  24.     <tag>Inc</tag>
  25.   </snippet>
  26.   <snippet id="namespace">
  27.     <text><![CDATA[namespace ${1:ns}
  28. {
  29.     $0
  30. };
  31. ]]></text>
  32.     <description>namespace ..</description>
  33.     <tag>namespace</tag>
  34.   </snippet>
  35.   <snippet id="gpl">
  36.     <text><![CDATA[/*
  37.  * ${1:[$GEDIT_BASENAME,<filename>]}
  38.  * This file is part of ${2:<program name>}
  39.  *
  40.  * Copyright (C) $<3: import datetime; return str(datetime.date.today().year)> - $<4:
  41. import pwd, os
  42. try:
  43.   return pwd.getpwuid(os.getuid()).pw_gecos.split(',')[0]
  44. except KeyError:
  45.   return '<author\>' >
  46.  *
  47.  * ${2} is free software; you can redistribute it and/or modify
  48.  * it under the terms of the GNU General Public License as published by
  49.  * the Free Software Foundation; either version 2 of the License, or
  50.  * (at your option) any later version.
  51.  *
  52.  * ${2} is distributed in the hope that it will be useful,
  53.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  54.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  55.  * GNU General Public License for more details.
  56.  *
  57.  * You should have received a copy of the GNU General Public License
  58.  * along with ${2}; if not, write to the Free Software
  59.  * Foundation, Inc., 51 Franklin St, Fifth Floor, 
  60.  * Boston, MA  02110-1301  USA
  61.  */
  62.  
  63.  $0]]></text>
  64.     <tag>gpl</tag>
  65.     <description>GPL License</description>
  66.   </snippet>
  67.   <snippet id="lgpl">
  68.     <text><![CDATA[/*
  69.  * ${1:[$GEDIT_BASENAME,<filename>]}
  70.  * This file is part of ${2:<library name>} 
  71.  *
  72.  * Copyright (C) $<3: import datetime; return str(datetime.date.today().year)> - $<4:
  73. import pwd, os
  74. try:
  75.   return pwd.getpwuid(os.getuid()).pw_gecos.split(',')[0]
  76. except KeyError:
  77.   return '<author\>' >
  78.  *
  79.  * ${2} is free software; you can redistribute it and/or
  80.  * modify it under the terms of the GNU Lesser General Public
  81.  * License as published by the Free Software Foundation; either
  82.  * version 2.1 of the License, or (at your option) any later version.
  83.  * 
  84.  * ${2} is distributed in the hope that it will be useful,
  85.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  86.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  87.  * Lesser General Public License for more details.
  88.  * 
  89.  * You should have received a copy of the GNU Lesser General Public
  90.  * License along with this library; if not, write to the Free Software
  91.  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  92.  */
  93.  
  94.  $0]]></text>
  95.     <tag>lgpl</tag>
  96.     <description>LGPL License</description>
  97.   </snippet>
  98.   <snippet id="td">
  99.     <text><![CDATA[typedef ${1:newtype} ${2:type};
  100. $0]]></text>
  101.     <tag>td</tag>
  102.     <description>typedef</description>
  103.   </snippet>
  104.   <snippet id="class">
  105.     <text><![CDATA[class ${1:name}
  106. {
  107.     public:
  108.         ${1:name} (${2:arguments});
  109.         virtual ~${1:name} ();
  110.  
  111.     private:
  112.         ${0:/* data */}
  113. };]]></text>
  114.     <description>class ..</description>
  115.     <tag>class</tag>
  116.   </snippet>
  117.   <snippet id="struct">
  118.     <text><![CDATA[struct ${1:name}
  119. {
  120.     ${0:/* data */}
  121. };]]></text>
  122.     <tag>struct</tag>
  123.     <description>struct</description>
  124.   </snippet>
  125.   <snippet id="template">
  126.     <text><![CDATA[template <typename ${1:_InputIter}>]]></text>
  127.     <description>template <typename ..></description>
  128.     <tag>template</tag>
  129.   </snippet>
  130.   <snippet id="gobject">
  131.     <text><![CDATA[#ifndef __${1:NAME}_H__
  132. #define __$1_H__
  133.  
  134. #include <${2:glib-object.h}>
  135.  
  136. G_BEGIN_DECLS
  137.  
  138. $<
  139. global camel_str
  140. components = $1.split('_')
  141. type_str = '_'.join([components[0], 'TYPE'] + components[1:])
  142. is_str = '_'.join([components[0], 'IS'] + components[1:])
  143. camel_str = ''
  144.  
  145. for t in components:
  146.   camel_str += t.capitalize()
  147.  
  148. items = [ \
  149. ['#define ' + type_str, '(' + $1.lower() + '_get_type ())'], \
  150. ['#define ' + $1 + '(obj)', '(G_TYPE_CHECK_INSTANCE_CAST ((obj), ' + type_str + ', ' + camel_str + '))'], \
  151. ['#define ' + $1 + '_CONST(obj)', '(G_TYPE_CHECK_INSTANCE_CAST ((obj), ' + type_str + ', ' + camel_str + ' const))'], \
  152. ['#define ' + $1 + '_CLASS(klass)', '(G_TYPE_CHECK_CLASS_CAST ((klass), ' + type_str + ', ' + camel_str + 'Class))'], \
  153. ['#define ' + is_str + '(obj)', '(G_TYPE_CHECK_INSTANCE_TYPE ((obj), ' + type_str + '))'], \
  154. ['#define ' + is_str + '_CLASS(klass)', '(G_TYPE_CHECK_CLASS_TYPE ((klass), ' + type_str + '))'], \
  155. ['#define ' + $1 + '_GET_CLASS(obj)', '(G_TYPE_INSTANCE_GET_CLASS ((obj), ' + type_str + ', ' + camel_str + 'Class))']
  156. ]
  157.  
  158. return align(items) >
  159.  
  160. $<[1]:
  161. items = [ \
  162. ['typedef struct _' + camel_str, camel_str + ';'], \
  163. ['typedef struct _' + camel_str + 'Class', camel_str + 'Class;'], \
  164. ['typedef struct _' + camel_str + 'Private', camel_str + 'Private;'] \
  165. ]
  166.  
  167. return align(items) >
  168.  
  169. struct _$<[1]: return camel_str > {
  170.     ${7:GObject} parent;
  171.     
  172.     $<[1]: return camel_str >Private *priv;
  173. };
  174.  
  175. struct _$<[1]: return camel_str >Class {
  176.     $7Class parent_class;
  177. };
  178.  
  179. GType $< return $1.lower() + '_get_type' > (void) G_GNUC_CONST;
  180. $<[1]: return camel_str > *$< return $1.lower()>_new (void);
  181.  
  182. $0
  183. G_END_DECLS
  184.  
  185. #endif /* __$1_H__ */]]></text>
  186.     <tag>gobject</tag>
  187.     <description>GObject template</description>
  188.   </snippet>
  189.   <snippet id="ginterface">
  190.     <text><![CDATA[#ifndef __${1:NAME}_H__
  191. #define __$1_H__
  192.  
  193. #include <${2:glib-object.h}>
  194.  
  195. G_BEGIN_DECLS
  196.  
  197. $<
  198. global camel_str
  199. components = $1.split('_')
  200. type_str = '_'.join([components[0], 'TYPE'] + components[1:])
  201. is_str = '_'.join([components[0], 'IS'] + components[1:])
  202. camel_str = ''
  203.  
  204. for t in components:
  205.   camel_str += t.capitalize()
  206.  
  207. items = [ \
  208. ['#define ' + type_str, '(' + $1.lower() + '_get_type ())'], \
  209. ['#define ' + $1 + '(obj)', '(G_TYPE_CHECK_INSTANCE_CAST ((obj), ' + type_str + ', ' + camel_str + '))'], \
  210. ['#define ' + is_str + '(obj)', '(G_TYPE_CHECK_INSTANCE_TYPE ((obj), ' + type_str + '))'], \
  211. ['#define ' + $1 + '_GET_INTERFACE(obj)', '(G_TYPE_INSTANCE_GET_INTERFACE ((obj), ' + type_str + ', ' + camel_str + 'Iface))']
  212. ]
  213.  
  214. return align(items) >
  215.  
  216. $<[1]:
  217. items = [ \
  218. ['typedef struct _' + camel_str, camel_str + ';'], \
  219. ['typedef struct _' + camel_str + 'Iface', camel_str + 'Iface;'], \
  220. ]
  221.  
  222. return align(items) >
  223.  
  224. struct _$<[1]: return camel_str >Iface
  225. {
  226.     ${7:GTypeInterface} parent;
  227.     
  228.     const gchar * (*example_method) ($<[1]: return camel_str > *self);
  229. };
  230.  
  231. GType $< return $1.lower() + '_get_type' > (void) G_GNUC_CONST;
  232.  
  233. const gchar *$< return $1.lower()>_example_method ($<[1]: return camel_str > *self);
  234. $0
  235. G_END_DECLS
  236.  
  237. #endif /* __$1_H__ */]]></text>
  238.     <tag>ginterface</tag>
  239.     <description>GObject interface</description>
  240.   </snippet>
  241. </snippets>
  242.